/* name: bracket
 * author: 5ab
 * created at: 2024-05-30
 */
#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define ssz(x) (int((x).size()))

auto chmax = [](auto& x, auto y) { if (x < y) x = y; };
auto chmin = [](auto& x, auto y) { if (y < x) x = y; };

using ll = long long;
const int N = 300;

char s[N + 1];

signed main()
{
	freopen("bracket.in", "r", stdin);
	freopen("bracket.out", "w", stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	
	cin >> n >> s;
	vector<int> xs;
	for (int i = 0; i < n; i++)
		if (s[i] == 'x')
			xs.push_back(i);
	
	auto chk = [&]() -> bool
	{
		int sm = 0;
		for (int i = 0; i < n; i++)
		{
			sm += (s[i] == '(' ? 1 : -1);
			if (sm < 0) return 0;
		}
		return sm == 0;
	};
	
	int lim = 1 << ssz(xs), ans = 0;
	for (int i = 0; i < lim; i++)
	{
		for (int j = 0; j < ssz(xs); j++)
			s[xs[j]] = ")("[(i >> j) & 1];
		if (chk())
			ans++;
		else
		{
			bool ok = 0;
			for (int j = 0; j < n; j++)
			{
				int k = j;
				for (k = j; k < n; k++)
				{
					s[k] = ')' + '(' - s[k];
					if (chk())
					{
						ok = 1;
						break;
					}
				}
				if (k == n) k--;
				while (k >= j)
					s[k] = ')' + '(' - s[k], k--;
				if (ok) break;
			}
			ans += ok;
		}
	}
	cout << ans << endl;
	
	return 0;
}
// started coding at: 05-30 12:36:50